package com.zhiyizhen.callnumber;

import android.app.Application;

import com.zhiyizhen.callnumber.common.AppUtil;
import com.zhiyizhen.callnumber.common.HeaderInterceptor;
import com.zhiyizhen.callnumber.common.LogUtil;
import com.zhiyizhen.callnumber.common.NetUtil;
import com.zhiyizhen.callnumber.common.ResponseInterceptor;
import com.zhiyizhen.callnumber.common.ServerHost;
import com.zhiyizhen.callnumber.net.RetrofitHelper;
import com.orhanobut.logger.BuildConfig;

/**
 * description
 *
 * @author dahu \n
 */
public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        AppUtil.init(this);
        LogUtil.init();
        initNetLib();
    }

    private void initNetLib() {
        HeaderInterceptor headerInterceptor = HeaderInterceptor.getInstance();
        headerInterceptor.addHeaders(NetUtil.getHeaders());
        RetrofitHelper.getInstance().init(this, ServerHost.getServerAddress(), BuildConfig.DEBUG, headerInterceptor, new ResponseInterceptor());
    }
}
